import 'package:aio/aio.dart';

//"FactoryName": "江花玻璃（庄桥）",
//"DeliveryAddressType": "工厂",
//"DeliveryAddress": "宁波市鄞州区宁波鄞州万达广场",
//"Distance": "16.60"
//"StartLongitude": "121.537466",
//"StartLatitude": "29.934521",
//"EndLongitude": "121.55153",
//"EndLatitude": "29.833187"
///送货地址信息
class Address extends BaseBean {
  String? FreightId = ""; //0代表是新增路线， 标识一下。

  ///判断是否为新增路线。
  bool isNew() {
    if ("0" == FreightId?.trim()) {
      return true;
    }
    return false;
  }

  //发货工厂（起始）
  String? FactoryName = "";

  //送货地址类型
  String? DeliveryAddressType = "";

  //详细送货地址（终点）
  String? DeliveryAddress = "";

  //距离
  String? Distance = "";

  //路线偏好
  String? RoutePreference = "";

  //起点经度
  String? StartLongitude = "";

  //起点纬度
  String? StartLatitude = "";

  //终点经度
  String? EndLongitude = "";

  //终点纬度
  String? EndLatitude = "";

  @override
  fromJson(Map<String, dynamic> json) {
    // TODO: implement fromJson
    FreightId = json['FreightId']?.toString() ?? "";
    FactoryName = json['FactoryName']?.toString() ?? "";
    DeliveryAddressType = json['DeliveryAddressType']?.toString() ?? "";
    DeliveryAddress = json['DeliveryAddress']?.toString() ?? "";
    Distance = json['Distance']?.toString() ?? "";
    RoutePreference = json['RoutePreference']?.toString() ?? "";
    StartLongitude = json['StartLongitude']?.toString() ?? "";
    StartLatitude = json['StartLatitude']?.toString() ?? "";
    EndLongitude = json['EndLongitude']?.toString() ?? "";
    EndLatitude = json['EndLatitude']?.toString() ?? "";
    // json?.forEach((key, value) {
    //   print("key:$key\tvalue:\t$value");
    // });
  }

  @override
  instance() {
    // TODO: implement instance
    return Address();
  }

  @override
  Map<String, dynamic> toJson() {
    // TODO: implement toJson
    var map = <String, dynamic>{};
    map["FactoryName"] = FactoryName;
    map["DeliveryAddressType"] = DeliveryAddressType;
    map["DeliveryAddress"] = DeliveryAddress;
    map["Distance"] = Distance;
    map["RoutePreference"] = RoutePreference;
    map["StartLongitude"] = StartLongitude;
    map["StartLatitude"] = StartLatitude;
    map["EndLongitude"] = EndLongitude;
    map["EndLatitude"] = EndLatitude;
    map["FreightId"] = FreightId;
    return map;
  }
}
